// /**
//  * https://leetcode.cn/problems/coin-change/
//  * @param {number[]} coins
//  * @param {number} amount
//  * @return {number}
//  */
let res=-1;
let caches=[];
let cache={};
let memo=[];
let abc=[];
var coinChange = function(coins, amount,path=[],coin=null) {
  // coins.forEach(element => {
  //   cache[element]=0;
  // });
  if(coin){
    abc.push(coin);
  }
  if(amount<1){
    memo.push(path)
    path=[];
    console.log('==========')
    return 
  }
  
  for(let i=0;i<coins.length;i++){
    remain=amount-coins[i]
    if(amount>=coins[i]){
      console.log()
      // path.push(coins[i])
    }
    
    if(remain==0){
      coinChange(coins,remain,path,coins[i])
      //console.log('结束',`amount:${amount}`,`coins[i]:${coins[i]}`,`remain:${remain}`)
      
    }else if(remain<0){
     // console.log('不能减',`amount:${amount}`,`coins[i]:${coins[i]}`,`remain:${remain}`)
    }else{
      //console.log('继续减',`amount:${amount}`,`coins[i]:${coins[i]}`,`remain:${remain}`)
      
      // cache[0][coins[i]]+=1;
      coinChange(coins,remain,path,coins[i])
    }
    
  }
  // console.log(memo)
  console.log(abc)
  return res;
};

function findWays(coins,amount,count){

}
console.log('res',coinChange([1,2,3,4],3));